#include<bits/stdc++.h>
using namespace std;
void div(string &a,int b)
{
    string ret;
    int az=a.size();
    int count=0;
    for(int i=0;i<az;i++)
    {
        
        int tem1=a[i]-'0'+10*count;
        int tem2=b;
        count=tem1%tem2;
        ret.push_back(tem1/tem2+'0');
    }
    reverse(ret.begin(),ret.end());
    while(ret.size()>1&&ret[ret.size()-1]=='0') ret.pop_back();
    reverse(ret.begin(),ret.end());
    cout<<ret<<endl<<count;
}

int main()
{
    string a;int b;
    cin>>a>>b;
    div(a,b);
    return 0;
}